
#include "member_BHandler.h"

using namespace BWE;

member_BHandler::member_BHandler(BHandler* handler)
{
	boss = handler;
	viewer = 0;
	master = 0;
}

member_BHandler::~member_BHandler()
{

}

void member_BHandler::setViewer(BViewer* viewer)
{
	if (this->viewer != viewer)
	{
		if (this->viewer)
		{
			BEvent event(Event_Detach);
			boss->event(event);
		}
		this->viewer = viewer;
		if (this->viewer)
		{
			BEvent event(Event_Attach);
			boss->event(event);
		}
		for (int i = 0; i < slaves.size(); i++)
		{
			BHandler* slave = slaves[i];
			handler_member(slave)->setViewer(viewer);
		}
	}
}
